package com.taotao.search.configuration;


import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.net.MalformedURLException;

/**
 * Created by zhang_xming on 2017/2/19.
 */
@Configuration
//@EnableSolrRepositories(multicoreSupport = true)
@ConfigurationProperties(prefix = "solr", locations = "classpath:application.properties")
public class SolrConfiguration {
    private String solrHost;
    public String getSolrHost() {
        return solrHost;
    }

    public void setSolrHost(String solrHost) {
        this.solrHost = solrHost;
    }


    @Bean
    public SolrClient solrServer() throws MalformedURLException {
        return new HttpSolrClient(solrHost);
    }
}
